<template>
  <div id="app">
    <div v-show="!isBusiness">
      <RightBar v-show="isShow"/>
      <TopBar v-show="isShow"/>
      <Navbar v-show="isShow" class="nav"/>
      <Suspension v-show="showCart"></Suspension>
    </div>
    <router-view></router-view>
    <div class="footer" v-show="isShow && !isBusiness">
<!--      <foot></foot>-->
    </div>
  </div>
</template>

<script>
  import TopBar from "./components/content/topbar/TopBar";
  import Navbar from "./components/content/navbar/Navbar";
  import RightBar from "./components/content/rightbar/RightBar";
  import Suspension from "./components/content/suspension/Suspension";
  import {eventBus} from "./common/util";
  import Foot from "./views/foot/Foot";
  import {sendwithget, sendwithpost} from "./network/profile";

  export default {
    name: 'app',
    data() {
      return {
        isShow: true,
        showCart: false
      }
    },
    components: {
      Navbar,
      TopBar,
      RightBar,
      Suspension,
      Foot
    },
    mounted() {
        this.$store.dispatch('getGoodsType');
        this.$store.dispatch('getUser', this);
        this.$store.dispatch('getSystemMessage');
        // sendwithpost({
        //   url: '/getUser',
        // }).then(res=> {
        //   this.$store.commit('changeLogn', res.data.user)
        //   this.$store.dispatch('getCart')
        //   this.$store.dispatch('getCoupon')
        //   this.$socket.
        // })
        eventBus.$on('showCart', ()=> {
          this.showCart = true
        })
        eventBus.$on('hideCart', ()=> {
          this.showCart = false
        })

    },
    beforeUpdate() {
      if (this.$route.path === '/register' || this.$route.path === '/signIn' || this.$route.path == '/chat') {
        this.isShow = false
      } else {
        this.isShow = true
      }

    },
    methods: {

    },
    computed: {
      isBusiness() {
        return this.$route.path.includes('/business');
      }
    }

  }
</script>

<style>
  @import "assets/css/normalize.css";
  #app {
  }
  a {
    text-decoration: none;
  }
  :root {
    --main-color: rgb(255,63,0)
  }
  * {
    font-family: "宋体";
  }
  .footer {
    width: 100%;
    background-color: #333333;
  }
</style>
